document.getElementById("save").onclick=function(){
	var data={}
	data.level=$("#level").attr("level")
	data.value=$("#value").val()
	data.free=$("#free").val()
	console.log(data)
	
	if(data.level===""){
		showErrorInfo("当前不可操作,请刷新页面！")
		return false;
	}
	if(data.value===""){
		showErrorInfo("请填写累计充值金额！")
		return false;
	}
	if(data.free===""){
		showErrorInfo("请填写优惠额！")
		return false;
		
	}
	data=JSON.stringify(data)
	$.ajax({
		"url":"/mem_level/",
		"error":errorAjax,
		"beforeSend":start_load_pic,
		"complete":stop_load_pic,
		"data":{"data":data},
		"type":getQ().type,
		"success":function(data){
			if(responseCheck(data)){
				alert("操作成功!")
				window.opener.location.reload()
				window.close()
			}
		}
	})
}
document.getElementById("value").focus()
function parseData(){
	if (getQ().type==="PUT"){
		var data=getQ().data
		data=JSON.parse(data)
		$("#level").val(data.level+"星级会员").attr("level",data.level)
		$("#value").val(data.value)
		$("#free").val(data.free)
	}
	else if(getQ().type==="POST"){
		$.ajax({
			"url":"/mem_level/",
			"error":errorAjax,
			"complete":stop_load_pic,
			"beforeSend":start_load_pic,
			"dataType":"jsonp",
			"data":{"action":"tmp"},
			"success":function(data){
				if(responseCheck(data)){
					$("#level").val(data.content+"星级会员").attr("level",data.content)
				}
			}
		})
	}
}
parseData()
